Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
How do I fix "Uncaught TypeError: can't access property "whenGET", $httpBackend is undefined"?

I am trying to use the following https://embed.plnkr.co/plunk/pWNOdA in a project that uses strict-DI.

In the app-mockbackend.js you can see the following setup -

angular.module('app').run(function($httpBackend, ServerDataModel) {
    
    $httpBackend.whenGET('/games').respond(function(method, url, data) {
        var games = ServerDataModel.findAll();
        return [200, games, {}];
    });
}]);

When you run the app without strict it runs fine, but when you add ng-strict-di to your app I get:

Uncaught TypeError: can't access property "whenGET", $httpBackend is undefined

I have read the docs and with other areas, I have had to annotate services while using strict and the errors have subsided and it's great - I just cannot seem to figure this one out.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Hey Dale did you try to annotate the function?

https://docs.angularjs.org/guide/di#dependency-annotation

For example:

someModule.controller('MyController', ['$scope', 'greeter', function($scope, greeter) { // ... }]);

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!